window.onload = function() {
	// alert(JSON);
	var oBtn = document.getElementsByTagName('button')[0];
	var oUl = document.getElementsByTagName('ul')[0];

	oBtn.onclick = function() {
		ajax({
			cache: false,
			url: getRootPath() + '/ajax/employees',
			success: function(data) {
				for(var i = 0; i < data.length; i++) {
					var oLi = document.createElement('li');
					oLi.innerHTML = data[i].name + '-' + data[i].gender + 
						'-' + data[i].department.name;
					oUl.appendChild(oLi);
				} 
			},
			error: function() {
				alert('出错: 服务器状态码是 ' + this.status);
			}
		});
	};
};


